<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    video{
      width: 500px;
    }
  </style>
</head>
<body>
  <canvas id="canvas" width="600" height="400"></canvas>
  <button>点击</button>
  <video src="./img/1.mp4" controls></video>
  <script>
    /** @type {HTMLCanvasElement} */
    var canvas=document.querySelector("#canvas")
    var ctx=canvas.getContext("2d")
    var video=document.querySelector("video")
    var btn=document.querySelector("button")
    var img=new Image()
    img.src="./img/001.jpg"
    var shi=true
    img.onload=function(){
      
      btn.onclick=function(){
        if(shi){
          video.play()
          shi=false
        }
        else{
          video.pause()
          shi=true
        }
      // console.log(111);
      sp()
    }
    function sp(){
      // console.log(11);
      ctx.drawImage(video,0,0,400,300)
      ctx.drawImage(img,0,0,100,100)
      requestAnimationFrame(sp)
    }
    }
    
  </script>
</body>
</html>